package com.bnyy.medicalHousekeeper.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.bnyy.common.adapter.BaseNormalListAdapter;
import com.bnyy.medicalHousekeeper.R;
import com.bnyy.medicalHousekeeper.bean.ShopDetail;

/**
 * Author : 关炳鹏
 * Description :
 * Date : 2023/2/9
 **/
public class ShopDetailAdapter extends BaseNormalListAdapter<ShopDetail, ShopDetailAdapter.ViewHolder> {

    public ShopDetailAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder(inflater.inflate(R.layout.item_shop_detail, parent, false));
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);

        ShopDetail shopDetail = getData(position);

        holder.tvMonth.setText(shopDetail.getMonth());
        holder.tvCount.setText(shopDetail.getCount());
    }

    static class ViewHolder extends BaseNormalListAdapter.ViewHolder {

        TextView tvMonth;
        TextView tvCount;

        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            tvMonth = itemView.findViewById(R.id.tv_month);
            tvCount = itemView.findViewById(R.id.tv_count);
        }
    }
}
